WeightedAverage (fld, fld), WeightedAverage (fld, fld, condFld), WeightedAverage (fld, fld, condFld, cond)

Basic and Crystal syntax.

Arguments
Returns

Fractional Number

Action

Enables you to calculate the weighted average of the specified fields. When you calculate a weighted average, you are actually calculating the average of one field and then using the values in another field to "weigh" the contribution of each value in the first field to the average. In a normal average, all the weights are equal to 1.

For example:

Examples

The following examples are applicable to both Basic and Crystal syntax:

WeightedAverage({table.FIELD1}, {table.FIELD2})

Returns 1.75, where the two fields have four values each. Field1 has values of 3, 2, 5, and 1. Table2 has values of 0, 1, 1, and 0. WeightedAverage calculates as follows: (3*0 + 2*1 + 5*1 + 1*0)/4 = 1.75.

Note:    Using this function in a formula forces the formula to be evaluated at print time. For more information on evaluation time considerations, see the Evaluation Time functions.



Seagate Software, Inc.
http://www.seagatesoftware.com
Please send comments to:
techpubs@seagatesoftware.com